package com.hu.network.task.impl;

import android.content.Context;

import com.alibaba.fastjson.TypeReference;

import java.util.Map;

import com.hu.network.http.bean.InnerRequestBean;
import com.hu.network.http.bean.InnerResponseResult;
import com.hu.network.http.request.IHttpRequest;
import com.hu.network.http.request.impl.JsonMutiPostHttpRequestImpl;
import com.hu.network.task.AbstractTask;

/**
 * 说明：
 *
 * @author ： hucanhua
 * @date ： 2017/11/03
 */
public class MutiPostTaskImpl<V> extends AbstractTask<V> {
    private final Map<String, Object> baseRequestBeans;
    private final TypeReference<V> tTypeReference;

    public MutiPostTaskImpl(Context context, Map<String, Object> baseRequestBeans, boolean useHttps, String url, TypeReference<V> tTypeReference, ITaskCallback<V> iTaskCallback) {
        super(context, useHttps, url, iTaskCallback);
        this.baseRequestBeans = baseRequestBeans;
        this.tTypeReference = tTypeReference;
    }

    @Override
    protected boolean before(InnerResponseResult<V> innerResponseResult) {
        return true;
    }

    @Override
    protected void after(InnerResponseResult<V> innerResponseResult) {
    }

    @Override
    protected IHttpRequest<V> getRequest() {
        return new JsonMutiPostHttpRequestImpl<>(new InnerRequestBean<>(useHttps, url, baseRequestBeans), tTypeReference, null, null);
    }
}
